UserDataSeeder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 68
dl 0
loc 75
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Function

Rating   Name   Duplication   Size   Complexity  
B run 0 73 2
1
import { DataSource } from 'typeorm';
2 7
import { User } from '../../users/entities/user.entity';
3
4 7
export default class UserDataSeeder {
5
  async run(connection: DataSource): Promise<void> {
6 9
    if (true) {
7
      //process.env.NODE_ENV !== 'production') {
8 9
      const userRepo = connection.getRepository(User);
9
10
      // Add example admin and test users
11 9
      await userRepo.save([
12
        {
13
          githubId: '149484382',
14
          username: 'Pbris',
15
          email: '[email protected]',
16
          roles: ['admin'],
17
          hasAcceptedTerms: true,
18
          isMonthlyPayment: false,
19
          accumulatedCost: 0,
20
          balance: 100,
21
        },
22
        {
23
          githubId: '149296874',
24
          username: 'airhelios',
25
          email: '[email protected]',
26
          roles: ['admin'],
27
          hasAcceptedTerms: true,
28
          isMonthlyPayment: true,
29
          accumulatedCost: 0,
30
        },
31
        {
32
          githubId: '13668660',
33
          username: 'KarlComSe',
34
          email: '[email protected]',
35
          roles: ['admin'],
36
          hasAcceptedTerms: true,
37
          isMonthlyPayment: true,
38
          accumulatedCost: 0,
39
        },
40
        {
41
          githubId: '149683406',
42
          username: 'gumme1',
43
          email: '[email protected]',
44
          roles: ['admin'],
45
          hasAcceptedTerms: true,
46
          isMonthlyPayment: true,
47
          accumulatedCost: 0,
48
        },
49
        {
50
          githubId: '123456789',
51
          username: 'johndoe',
52
          email: '[email protected]',
53
          roles: ['user'],
54
          hasAcceptedTerms: true,
55
          avatarUrl: 'https://example.com/john.jpg',
56
          isMonthlyPayment: true,
57
          accumulatedCost: 0,
58
        },
59
        {
60
          githubId: '234567890',
61
          username: 'janedoe',
62
          email: '[email protected]',
63
          roles: ['user', 'admin'],
64
          hasAcceptedTerms: true,
65
          avatarUrl: 'https://example.com/jane.jpg',
66
          isMonthlyPayment: true,
67
          accumulatedCost: 0,
68
        },
69
        {
70
          githubId: '345678901',
71
          username: 'bobsmith',
72
          email: '[email protected]',
73
          roles: ['user'],
74
          hasAcceptedTerms: false,
75
          avatarUrl: 'https://example.com/bob.jpg',
76
          isMonthlyPayment: true,
77
          accumulatedCost: 0,
78
        },
79
      ]);
80
    }
81
  }
82
}
83